package com.robot.admin.pojo;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Collection;

/**
 * roles实体类
 * @author wuyunbin
 *
 */
@Entity
@Table(name="roles")
public class Roles implements Serializable{

	/**
	 *id
	 */
	@Id
	private String id;


	
	/**
	 *name
	 */
	private String name;

	/**
	 * 用户集合
	 */
	@ManyToMany(mappedBy = "roles")
	private Collection<Admin> admin;

	/**
	 * 权限集合
	 */
	@ManyToMany
	@JoinTable(name = "roles_privileges", joinColumns = @JoinColumn(name = "role_id", referencedColumnName = "id"),
			inverseJoinColumns = @JoinColumn(name = "privilege_id", referencedColumnName = "id"))
	private Collection<Privilege> privileges;



	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public Collection<Admin> getAdmin() {
		return admin;
	}

	public void setAdmin(Collection<Admin> admin) {
		this.admin = admin;
	}

	public Collection<Privilege> getPrivileges() {
		return privileges;
	}

	public void setPrivileges(Collection<Privilege> privileges) {
		this.privileges = privileges;
	}
}
